<template>
	<view class="mine-pages-setting" :style="{background:pageColor}">
		<view class="space-md"></view>
		<view @tap.stop="goDetail(index,'infoList')" class="flex-between pd-lg fill-base f-title c-title"
			:class="[{'mb-md':index==0},{'b-1px-b':index!==0}]" v-for="(item,index) in infoList" :key="index">
			<view>{{item.text}}</view>
			<i class="iconfont icon-right text-bold" style="color:#C7C7C7;font-size: 22rpx;"></i>
		</view>
		<view class="flex-between pd-lg fill-base f-title c-title">
			<view>注册时间</view>
			<view class="">{{coachInfo | handleTime}}</view>
		</view>
		<view @tap.stop="$util.toLoginOut(2)" class="flex-center pd-lg fill-base f-title c-black mt-md">
			退出登录
		</view>
	</view>
</template>

<script>
	import {
		mapState,
		mapActions,
		mapMutations
	} from "vuex"
	import $util from "@/utils/index.js"
	export default {
		data() {
			return {
				isLoad: false,
				options: {},
				infoList: [{
					text: '账号设置',
					url: `/technician/pages/account/setting`
				}, {
					text: '隐私政策',
					url: `/user/pages/protocol`
				}, {
					text: '服务协议',
					url: `/user/pages/information`
				}]
			}
		},
		computed: mapState({
			configInfo: state => state.config.configInfo,
			mineInfo: state => state.user.mineInfo,
		}),
		async onLoad() {
			this.initIndex()
		},
		methods: {
			...mapActions([]),
			...mapMutations(['updateUserItem']),
			async initIndex(refresh = false) {
				this.$util.setNavigationBarColor({
					bg: this.primaryColor
				})
				// #ifdef H5
				if (!refresh) {
					this.$jweixin.hideOptionMenu()
				}
				// #endif
			},
			initRefresh() {
				this.initIndex(true)
			},
			goDetail(index, key) {
				let {
					url
				} = this[key][index]
				this.$util.goUrl({
					url
				})
			}
		},
		filters: {
			handleTime(item) {
				let {
					create_time = ''
				} = item
				let text = create_time ? $util.formatTime(create_time * 1000, 'YY-M-D') : '-'
				return text
			}
		}
	}
</script>


<style lang="scss">
	.mine-pages-setting {
		.iconfont {
			color: #999
		}

		.c-title {
			color: #222;
		}

		.b-1px-b::after {
			left: 30rpx;
			right: 30rpx
		}
	}
</style>